package com.example.jianzhioffer;

/**
 * Created by Quincy on 2018/10/6.
 */
public class Power {
    public double Power(double base, int exponent) {
        double result = 1.000;
        int ex = Math.abs(exponent);
        boolean flag = true;
        if (exponent < 0)
            flag = false;
        while (ex > 0){
            result *= base;
            ex --;
        }
        if (flag == false)
            result = 1 / result;
        return result;
    }
}
